<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>ObservableSet (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">labs.observe.ObservableSet</span>
        <span>Extends</span>
        <span class="fn-name">
          Object
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    Creates a set of observables.

An ObservableSet is a collection of observables. Observers may be
reigstered and will receive notifications when any of the
observables notify. This class is meant to simplify management of
observations on multiple observables of the same nature.
  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="closure_goog_labs_observe_observableset.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/closure/goog/labs/observe/observableset.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.labs.observe.ObservableSet</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
</table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.labs.observe.ObservableSet(<span></span>)
  </div>



<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_labs_observe_ObservableSet.html">
              goog.labs.observe.ObservableSet
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.addObservable"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">addObservable<span class="args">(<span class="arg">observable</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>
      </div>


     <div class="entryOverview">
       Adds an observable to the set. All previously added and future
observers will be added to the new observable as well.

The observable will not be added if it is already registered in the
set.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">observable</span>
        : <div class="fullType"><span class="type"><a href="interface_goog_labs_observe_Observable.html">goog.labs.observe.Observable</a></span></div>
        <div class="entryOverview">The observable to add.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>&nbsp;
            Whether the observable is actually added.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line121">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.addObserver"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">addObserver<span class="args">(<span class="arg">observer</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>
      </div>


     <div class="entryOverview">
       Adds an observer that observes all observables in the set. If new
observables are added to or removed from the set, the observer will
be registered or unregistered accordingly.

The observer will not be added if there is already an equivalent
observer.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">observer</span>
        : <div class="fullType"><span class="type"><a href="interface_goog_labs_observe_Observer.html">goog.labs.observe.Observer</a></span></div>
        <div class="entryOverview">The observer to invoke.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>&nbsp;
            Whether the observer is actually added.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line66">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.removeAll"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">removeAll<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Removes all registered observations and observables.
     </div>

   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line164">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.removeAllObservables"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">removeAllObservables<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Removes all registered observables.
     </div>

   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line155">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.removeAllObservers"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">removeAllObservers<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Removes all registered observers.
     </div>

   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line105">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.removeObservable"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">removeObservable<span class="args">(<span class="arg">observable</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>
      </div>


     <div class="entryOverview">
       Removes an observable from the set. All observers registered on the
set will be removed from the observable as well.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">observable</span>
        : <div class="fullType"><span class="type"><a href="interface_goog_labs_observe_Observable.html">goog.labs.observe.Observable</a></span></div>
        <div class="entryOverview">The observable to remove.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>&nbsp;
            Whether the observable is actually removed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line140">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.removeObserver"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">removeObserver<span class="args">(<span class="arg">observer</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>
      </div>


     <div class="entryOverview">
       Removes an observer from the set. The observer will be removed from
all observables in the set. Does nothing if the observer is not in
the set.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">observer</span>
        : <div class="fullType"><span class="type"><a href="interface_goog_labs_observe_Observer.html">goog.labs.observe.Observer</a></span></div>
        <div class="entryOverview">The observer to remove.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span></div>&nbsp;
            Whether the observer is actually removed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line88">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.observe.ObservableSet.prototype.unregisterAll_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">unregisterAll_<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       Unregisters all registered observers from all registered observables.
     </div>

   
  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line174">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_labs_observe_ObservableSet.html">
              goog.labs.observe.ObservableSet
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.observe.ObservableSet.prototype.observables_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">observables_</span>
        : <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="interface_goog_labs_observe_Observable.html">goog.labs.observe.Observable</a></span>&gt;</div>
     </div>


     <div class="entryOverview">
       The observables in this set.
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line51">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.observe.ObservableSet.prototype.observers_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">observers_</span>
        : <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="interface_goog_labs_observe_Observer.html">goog.labs.observe.Observer</a></span>&gt;</div>
     </div>


     <div class="entryOverview">
       The observers registered with this set.
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_labs_observe_observableset.js.source.html#line44">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>










<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package labs.observe</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="labs.observe.ObservableSet"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
